package com.uatair.web.controller.business;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.uatair.common.annotation.Log;
import com.uatair.common.core.controller.BaseController;
import com.uatair.common.core.domain.AjaxResult;
import com.uatair.common.enums.BusinessType;
import com.uatair.system.domain.TpUavInfo;
import com.uatair.system.service.ITpUavInfoService;
import com.uatair.common.utils.poi.ExcelUtil;
import com.uatair.common.core.page.TableDataInfo;

/**
 * 飞机参数osdController
 * 
 * @author uatair
 * @date 2025-06-20
 */
@RestController
@RequestMapping("/system/info")
public class TpUavInfoController extends BaseController
{
    @Autowired
    private ITpUavInfoService tpUavInfoService;

    /**
     * 查询飞机参数osd列表
     */
    @PreAuthorize("@ss.hasPermi('system:info:list')")
    @GetMapping("/list")
    public TableDataInfo list(TpUavInfo tpUavInfo)
    {
        startPage();
        List<TpUavInfo> list = tpUavInfoService.selectTpUavInfoList(tpUavInfo);
        return getDataTable(list);
    }

    /**
     * 导出飞机参数osd列表
     */
    @PreAuthorize("@ss.hasPermi('system:info:export')")
    @Log(title = "飞机参数osd", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TpUavInfo tpUavInfo)
    {
        List<TpUavInfo> list = tpUavInfoService.selectTpUavInfoList(tpUavInfo);
        ExcelUtil<TpUavInfo> util = new ExcelUtil<TpUavInfo>(TpUavInfo.class);
        util.exportExcel(response, list, "飞机参数osd数据");
    }

    /**
     * 获取飞机参数osd详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:info:query')")
    @GetMapping(value = "/{sn}")
    public AjaxResult getInfo(@PathVariable("sn") String sn)
    {
        return success(tpUavInfoService.selectTpUavInfoBySn(sn));
    }

    /**
     * 新增飞机参数osd
     */
    @PreAuthorize("@ss.hasPermi('system:info:add')")
    @Log(title = "飞机参数osd", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TpUavInfo tpUavInfo)
    {
        return toAjax(tpUavInfoService.insertTpUavInfo(tpUavInfo));
    }

    /**
     * 修改飞机参数osd
     */
    @PreAuthorize("@ss.hasPermi('system:info:edit')")
    @Log(title = "飞机参数osd", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TpUavInfo tpUavInfo)
    {
        return toAjax(tpUavInfoService.updateTpUavInfo(tpUavInfo));
    }

    /**
     * 删除飞机参数osd
     */
    @PreAuthorize("@ss.hasPermi('system:info:remove')")
    @Log(title = "飞机参数osd", businessType = BusinessType.DELETE)
	@DeleteMapping("/{sns}")
    public AjaxResult remove(@PathVariable String[] sns)
    {
        return toAjax(tpUavInfoService.deleteTpUavInfoBySns(sns));
    }
}
